package com.program.cloudmanage.tripteam.service;

import com.program.cloudmanage.tripteam.domain.Itinerary;
import com.program.cloudmanage.tripteam.persistence.ItineraryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ItineraryService {
    @Autowired
    private ItineraryMapper itineraryMapper;
    public ItineraryService(){}
    public List<Itinerary> showItineraries(){
        return itineraryMapper.showItinerary();
    }
    public List<Itinerary> searchItineraryByTeamId(String teamId){
         return itineraryMapper.searchItineraryByTeamId(teamId);
    }
    public Itinerary  searchItinerary(String itineraryId){
         return itineraryMapper.searchItinerary(itineraryId);
    }
    public void insertItinerary(Itinerary itinerary){
        itineraryMapper.insertItinerary(itinerary.getItineraryid(),itinerary.getTeamid(),itinerary.getPersonid(),itinerary.getStartpoint(),itinerary.getTerminal(),itinerary.getSimilarity(),itinerary.getPass(),itinerary.getWayposition());

    }
    public void deleteItinerary(String itineraryid)
    {
        itineraryMapper.deleteItinerary(itineraryid);
    }
    public void updateItinerary(Itinerary itinerary){itineraryMapper.updateItinerary(itinerary.getItineraryid(),itinerary.getPass());}
    public void updateSimilarity(String id,String similarity){itineraryMapper.updateSimilarity(similarity,id);}
}
